Repository navigation
fix(solana): refresh deBridge's placeholder blockhash before signing - #133
Merged
Merged
Conversation
Adds tests for signing v0 transactions with an empty signature slot: a deBridge-style placeholder blockhash is replaced with a fresh one before signing, while a transaction already signed by another party keeps its blockhash so the co-signature stays valid. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
…ransactions deBridge builds Solana transactions with an all-zero recent blockhash and expects the signer to substitute a fresh one, so unsigned transactions now get the node's latest blockhash before our signature is made. Transactions that already carry another party's signature keep their blockhash, since changing it would void that signature. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
The versioned transaction tests now check the signature against the bytes actually sent rather than the pre-broadcast wire, and assert that the v0 version prefix is included in the signed message. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a malformed versioned transaction case where the account keys are intact but the recent blockhash is cut short, asserting the specific truncation error is returned. Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Tiny Sweeper review
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 13, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every deBridge Solana transaction (same-chain swaps from
/v1.0/chain/transaction, and DLN orders from Solana via/v1.0/dln/order/create-tx) was rejected in preflight:We hit this in production on OpenHuman's linked wallet.
Cause
recentBlockhashis the all-zero placeholder11111111111111111111111111111111. Its docs tell the integrator to settx.message.recentBlockhash = (await connection.getLatestBlockhash()).blockhashbefore signing.sign_and_broadcast_versioned(crypto/chains/solana/versioned.rs) signed the message as received.isBlockhashValidon the zero hash is false at every commitment level.simulateTransactionfails withreplaceRecentBlockhash:falseand passes withtrue.Fix
getLatestBlockhashfrom the same RPC it sends through. It overwrites those 32 bytes in place, so the v0 address lookup tables are never re-encoded, and then signs.Tests
Added in
solana/mod_tests.rs:a_debridge_placeholder_blockhash_is_replaced_with_a_fresh_one_before_signing. It checks that the RPC is asked for a blockhash before the send, that the sent message carries it, that it is the only byte range that changed, and that the signature verifies over the sent bytes. Before the fix it failed withleft: ["sendTransaction"] right: ["getLatestBlockhash", "sendTransaction"].a_transaction_another_party_already_signed_keeps_its_blockhash.Two existing tests asserted the bug (that the zero-blockhash message went out untouched). They now check against the broadcast bytes.
Verification
scripts/test-features.sh: 1998 passed, 0 failed.cargo fmt --checkis clean, andclippy -p tinywallet-web3 --all-targets --all-features -D warningsis clean.Follow-ups, not in this PR